<script>
import axios from "axios";
import {ElMessageBox} from "element-plus";

export default {
  name: "auitLoan",
  data(){
    return{
      loanList:[],
    }
  },
  methods:{
    choose(item){
      console.log(item.loanId);
      ElMessageBox.alert("审核是否通过",{
        showCancelButton: true,
        cancelButtonText:"不通过",
        confirmButtonText:"通过"
      }).then(()=>{
        axios.post("http://localhost:8080/auit",{loanId:item.loanId},{
          headers:{
            Authorization: localStorage.getItem("rootToken")
          }
        }).then((res)=>{

        })
      })
    }
  },
  mounted() {
      axios.get("http://localhost:8080/getAllLoan",{
        headers:{
          Authorization: localStorage.getItem("rootToken")
        }
      }).then((response) => {
        this.loanList = response.data.data;
      })
  }
}
</script>

<template>
  <el-card class="h-screen">
    <template #header>审核贷款申请表</template>
    <div  v-for="items in loanList" class="border-b">
      贷款申请人:{{items.user.userRealName}}<br>
      贷款申请时间:{{items.loanDate}}<br>
      贷款申请金额:{{items.loanAccount}}<br>
      贷款用途:{{items.loanUse}}<br>
      贷款还款期限:{{items.loanDay}}(天)<br>
      审核状态:{{items.auit}}<br>
      贷款编号:{{items.loanId}}<br>
      <a :href="`contact.html?loanId=${items.loanId}`"><el-button>查看合同</el-button></a>
      <el-button @click="choose(items)">审核</el-button>
    </div>
  </el-card>
</template>

<style scoped>

</style>